package com.xzy.Config;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.LocaleResolver;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class MyMvcConfig implements WebMvcConfigurer {
    @Autowired
    SystInterceptor systInterceptor;
    @Bean
    public LocaleResolver localeResolver(){
        return new MyLocaleResolver();
    }

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(systInterceptor).addPathPatterns("/**")
        .excludePathPatterns("/user/**","/","/img/**","/js/**",
                "css/**","/**.html","/webjars/springfox-swagger-ui/**")
        ;
        WebMvcConfigurer.super.addInterceptors(registry);
    }
}
